﻿@using CMSMVC4.MultiResource
@model List<CMSMVC4.Category>

@{
    ViewBag.Title = @Admin.Services;
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<script language="javascript" type="text/javascript">
    function dellall() {
        var chek = $('#checkall').is(':checked');
        if (chek == true) {
            $(".checker span").attr('class', "checked");
            $(".dell").attr('checked', true);
        } else {
            $(".checker span").attr('class', "");
            $(".dell").attr('checked', false);

        }
    }
    function senddell() {
        var id = [];
        $(".dell:checked").each(function () {
            var v = $(this).attr("index");
            id.push(v);
        });
        if (id.length > 0) {
            var cf = confirm("Bạn có chắc chắn muốn xóa không?");
            if (cf == true) {
                $.ajax({
                    type: "Post",
                    dataType: "json",
                    contentType: 'application/json; charset=utf-8',
                    url: "/Admin/Services/Delete",
                    data: JSON.stringify(id),
                    success: function () {
                        window.location = "/Admin/Services/List";
                    }
                });
            }
        } else {
            alert("Hãy chọn bưu gửi muốn xóa!");
        }
    }
</script>
<div class="row-fluid">
    <div class="box color_5">
        <div class="title">
            <h4><span>@Admin.Services <small></small></span></h4>
        </div>
        <div class="content top">
            <table id="datatable_example" class="responsive table table-striped table-bordered" style="width: 100%">
                <thead>
                    <tr>
                        <th class="jv no_sort">
                                <label class="checkbox ">
                                    <input type="checkbox" id="checkall" onchange="dellall()"/>
                                </label>
                            </th>
                        <th class="" style="display: none">ID</th>
                        <th class="">@Admin.NameService</th>
                        <th>Set Home</th>
                        <th class="">Danh Mục</th>
                        <th>@Admin.Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null)
                    {
                        foreach (var i in Model)
                        {
                            <tr>
                                <td>
                                    @Html.CheckBox("status",new{@class="dell",index =i.Id})
                                </td>
                                <td style="display: none">@i.Id</td>
                                @{Html.RenderAction("GetNameCate", "Services", new { id = i.Id });}
                                <td>@Html.Action("GetNameFoder","ThietBi",new{id = i.Id})</td>
                                <td class="ms">
                                    <a class="btn btn-small" rel="tooltip" data-original-title="@Admin.DetailOrEdit" data-ajax="false" 
                                       data-ajax-method="Get" data-ajax-mode="replace" data-ajax-success="showEditContact()" 
                                       href="@Url.Action("Add",new{id = i.Id})">
                                        <i class="gicon-edit"></i>
                                    </a>
                                     <a class="btn btn-small" onclick="senddell()">
                                        <i class="gicon-remove"></i>
                                    </a>
                                </td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>

<a class="btn btn-large btn-success" href="@Url.Action("Add","Services")">@Admin.AddService</a>
@*@if (Model != null)
{
    foreach (var i in Model)
    {
    <div>@{Html.RenderAction("GetNameCate", "Services", new { id = i.Id });}| @Html.ActionLink("edit", "Add", new { id = i.Id }) | @Html.ActionLink("Delete", "Delete", new { id = i.Id })</div>
    }
}*@